<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.4.4.min.js"></script>
</head>
<body>
<input type="button" onclick="add()" value="add">
<input type="button" onclick="findAll()" value="findAll">

</body>
</html>
<script>
    function add() {
        // 发送异步请求
        $.ajax({
            //请求类型
            type: "post",
            //请求路径
            url: "/json/add",
            //请求数据
            data: "{\"id\":1, \"username\":\"张三\",\"gender\":\"男\",\"birthday\":\"2022/12/08\"}",
            //    请求数据格式
            contentType: "application/json",
        //    成功回调
            success: function (data) {
                console.log(data)
            }
        });
    }

    function findAll() {
    //    异步请求获取json数据
        $.ajax({
            type: "get",
            url: "json/findAll",
            success: function (data) {
                console.log(data)
            }
        });
    }
</script>